package edu.etime.xsj.goods.service.controllers;

import edu.etime.xsj.goods.service.pojo.GoodsType;
import edu.etime.xsj.goods.service.pojo.GoodsTypeList;
import edu.etime.xsj.goods.service.services.interfaces.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * 商品类型管理controller
 */
@RestController
@RequestMapping("/service/goodstype")
public class GoodsTypeController {
    @Autowired
    private GoodsTypeService goodsTypeService;

    /**
     * 查询所有的商品类型
     * @return
     */
    @RequestMapping("/all")
    public GoodsTypeList selectAllGoodsType(){

        List<GoodsType> list = goodsTypeService.selectAllGoodsType();
        GoodsTypeList goodsTypeList = new GoodsTypeList();
        goodsTypeList.setGoodstypelist(list);
//        try {
//            Thread.sleep(3000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return goodsTypeList;
    }
}
